﻿using H.Types;
using System;

namespace H.Hands
{
    /// <summary>
    /// 表示一个键鼠操作的实例
    /// </summary>
    public interface IHand : IDisposable
    {
        #region 鼠标移动相关函数
        /// <summary>
        /// 将鼠标移动到指定位置
        /// </summary>
        /// <param name="point">相对于屏幕(0,0)的坐标点</param>
        /// <returns>返回是否执行成功</returns>
        bool MoveTo(Pos point);

        /// <summary>
        /// 将鼠标移动offset的偏移量
        /// </summary>
        /// <param name="offset"></param>
        /// <returns>返回是否执行成功</returns>
        bool MoveToRelative(Pos offset);

        /// <summary>
        /// 获取当前鼠标位置
        /// </summary>
        /// <param name="point">获取到的鼠标位置将通过此参数返回</param>
        /// <returns>返回是否执行成功</returns>
        bool MousePoint(ref Pos point);

        /// <summary>
        /// 鼠标左键实例
        /// </summary>
        /// <returns>鼠标操作实例</returns>
        IMouse LeftMouse();

        /// <summary>
        /// 鼠标中键实例
        /// </summary>
        /// <returns>鼠标操作实例</returns>
        IMouse MiddleMouse();

        /// <summary>
        /// 鼠标右键实例
        /// </summary>
        /// <returns>鼠标操作实例</returns>
        IMouse RightMouse();

        /// <summary>
        /// 鼠标滚轮向上滚动
        /// </summary>
        /// <param name="count"></param>
        /// <returns></returns>
        bool WheelUp(int count);

        /// <summary>
        /// 鼠标滚轮向下滚动
        /// </summary>
        /// <param name="count"></param>
        /// <returns></returns>
        bool WheelDown(int count);

        /// <summary>
        /// 鼠标滚轮控制,综合了ScrollUp和ScrollDown
        /// </summary>
        /// <param name="count">如果count为正数,表示向下滚动,调用ScrollDown,如果为负数,则调用ScrollUp</param>
        /// <returns></returns>
        bool Scroll(int count);

        /// <summary>
        /// 所有鼠标按键弹起
        /// </summary>
        /// <returns></returns>
        bool AllMouseUp();


        #endregion

        #region 键盘操作相关函数
        /// <summary>
        /// 创建一个按键的实例
        /// </summary>
        /// <param name="key">按键键码抽象</param>
        /// <returns>操作单个按钮的实例</returns>
        IKeyBoard CreateKey(HandKey key);

        /// <summary>
        /// 创建多个按钮同时操作的实例
        /// </summary>
        /// <param name="keys">按键键码抽象</param>
        /// <returns>同时操作多个按钮的实例</returns>
        IKeyBoard CreateKeys(params HandKey[] keys);

        /// <summary>
        /// 弹起所有键盘按键(弹起所有键盘按键)
        /// </summary>
        /// <returns>返回是否执行成功</returns>
        bool AllKeyUp();

        /// <summary>
        /// 获取大小写灯状态
        /// </summary>
        /// <param name="lightOn">大写灯状态</param>
        /// <returns>返回是否执行成功</returns>
        bool GetCapsLock(out bool lightOn);

        /// <summary>
        /// 获取小数字键盘灯状态
        /// </summary>
        /// <param name="lightOn">小数字键盘灯是否点亮</param>
        /// <returns>返回是否执行成功</returns>
        bool GetNumLock(out bool lightOn);

        #endregion

        #region 文字输入函数
        /// <summary>
        /// 输入一系列文字,包括中文和英文
        /// </summary>
        /// <param name="words">需要输入的单次或语句</param>
        /// <returns>是否执行成功</returns>
        bool InputString(string words);

        #endregion

    }
}
